package com.sgsg.delegatemode;

import java.util.ArrayList;

public class SubjectC implements Subject{


    public String getSubjectState() {
        return subject.getSubjectState();
    }

    public void setSubjectState(String subjectState) {
        subject.setSubjectState(subjectState);
    }

    //SubjectC代理了SubjectA
    Subject subject = new SubjectA();

    public void toSubjectB(){
        subject = new SubjectB();
    }

    @Override
    public void addObserver(Observer observer) {
        subject.addObserver(observer);
    }

    @Override
    public void detachObserver(Observer observer) {
        subject.detachObserver(observer);
    }

    @Override
    public void Notify() {
        subject.Notify();
    }
}
